﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FeedBackManager.ascx.cs" Inherits="NCS.Module.FeedBack.Admin.FeedBackManager" %>

<table class="InputBox" style="width: 100%;">
    <tr>
        <td align="left" style="width: 150;">
            Email nhận phản hồi:
        </td>
        <td>
            <asp:TextBox ID="txtEmailConfig" runat="server" Width="300"></asp:TextBox>
            <asp:RegularExpressionValidator ID="revEmail" runat="server" ControlToValidate="txtEmailConfig"
                Display="Dynamic" ErrorMessage="" ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Địa chỉ Email không hợp lệ</asp:RegularExpressionValidator>
            <br />
        </td>
    </tr>
    <tr>
        <td align="left">
            Chủ đề Email:</td>
        <td>
            <asp:TextBox ID="txtSubjectEMailConfig" runat="server" Width="300"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtSubjectEMailConfig"
                ErrorMessage="">Bạn cần nhập chủ đề email</asp:RequiredFieldValidator></td>
    </tr>
    <tr>
        <td></td>
        <td>
            <asp:Button ID="btn_UpdateEmail" runat="server" OnClick="btn_UpdateEmail_Click" Text="Cập nhật" />
        </td>
    </tr>
</table>
<table border="0" cellpadding="2" cellspacing="2" style="width: 100%">
    <tr>
        <td>
            &nbsp;</td>
        <td></td>
    </tr>
	<tr>
		<td valign="top" class="InputBox" style="width: 70%;">
			<strong>Trạng thái:</strong>
			<asp:DropDownList ID="dropStatus" runat="server" Width="195px" AutoPostBack="True" OnSelectedIndexChanged="dropStatus_SelectedIndexChanged">
				<asp:ListItem Value="2">Đ&#227; xử l&#253;</asp:ListItem>
				<asp:ListItem Value="1">Chưa xử l&#253;</asp:ListItem>
			</asp:DropDownList>
			<asp:GridView ID="GridView1" OnRowDeleting="GridView1_RowDeleting" runat="server" AutoGenerateColumns="false" BorderColor="Gainsboro"
				BorderStyle="Solid" BorderWidth="1px" CellPadding="2" CssClass="Grid" DataKeyNames="FeedBackID" Width="100%">
				<AlternatingRowStyle CssClass="Grid_Raw2" />
				<RowStyle CssClass="Grid_Raw1" />
				<HeaderStyle CssClass="Grid_Top" Font-Bold="True" />
				<SelectedRowStyle BackColor="Yellow" />
				<Columns>
					<asp:BoundField HeaderStyle-Width="5px" DataField="FeedBackID" />
					<asp:BoundField HeaderStyle-Width="0%" Visible="False" HeaderText="Người gửi" DataField="FullName" />
					<asp:BoundField HeaderStyle-Width="30%" DataField="Email" HeaderText="Email" />
					<asp:BoundField HeaderStyle-Width="40%" DataField="Subject" HeaderText="Chủ đề" />
					<asp:TemplateField HeaderText="Trạng th&#225;i">
					    <HeaderStyle Width="15%" />
						<ItemTemplate>
							<asp:DropDownList ID="dropStatus" runat="server" SelectedValue='<%# Eval("Status") %>' Enabled="false">
								<asp:ListItem Value="2">Đ&#227; xử l&#253;</asp:ListItem>
								<asp:ListItem Value="1">Chưa xử l&#253;</asp:ListItem>
							</asp:DropDownList>
						</ItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField HeaderText="Thao t&#225;c">
						<ItemStyle HorizontalAlign="Center" />
						<HeaderStyle HorizontalAlign="Center" Width="15%" />
						<ItemTemplate>
							<asp:Button ID="btnEdit" runat="server" Width="60" Text="Chi tiết" CommandName="select" CssClass="Button" />
							<asp:Button ID="btnDelete" OnClientClick="return confirm('Bạn có chắc chắn?');" runat="server" CommandName="delete" CssClass="Button" Text="Xoá"
								Width="60" />
						</ItemTemplate>
					</asp:TemplateField>
				</Columns>
			</asp:GridView>
			<%--<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DataObjectTypeName="NCS.Module.FeedBack.Library.Components.FeedBackInfo"
				DeleteMethod="DeleteFeedBack" InsertMethod="AddFeedBack" SelectMethod="GetFeedBacks"
				TypeName="NCS.Module.FeedBack.Library.Components.FeedBackController" UpdateMethod="UpdateFeedBack">
				<DeleteParameters>
					<asp:Parameter Name="fbId" Type="Int32" />
				</DeleteParameters>
				<SelectParameters>
					<asp:ControlParameter ControlID="dropStatus" Name="status" PropertyName="SelectedValue"
						Type="Int32" />
				</SelectParameters>
			</asp:ObjectDataSource>--%>
			<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" DataObjectTypeName="NCS.Module.FeedBack.Library.Components.FeedBackInfo"
				DeleteMethod="DeleteFeedBack" InsertMethod="AddFeedBack" SelectMethod="GetFeedBack"
				TypeName="NCS.Module.FeedBack.Library.Components.FeedBackController" UpdateMethod="UpdateFeedBack">
				<DeleteParameters>
					<asp:Parameter Name="fbId" Type="Int32" />
				</DeleteParameters>
				<SelectParameters>
					<asp:ControlParameter ControlID="GridView1" Name="fbId" PropertyName="SelectedValue"
						Type="Int32" />
				</SelectParameters>
			</asp:ObjectDataSource>
		</td>
		<td style="width: 30%" valign="top" class="InputBox">
			<asp:DetailsView ID="DetailsView1" runat="server" DataSourceID="ObjectDataSource2"
				Width="100%" AutoGenerateRows="False" DataKeyNames="FeedBackID" DefaultMode="edit" OnItemCommand="DetailsView1_ItemCommand" OnItemUpdated="DetailsView1_ItemUpdated">
				<RowStyle Height="30px" />
				<Fields>
					<asp:BoundField DataField="FullName" HeaderStyle-Width="100%" HeaderText="Người gửi" SortExpression="FullName" />
					<asp:BoundField DataField="Tel" HeaderText="Điện thoại" SortExpression="Tel" />
					<asp:BoundField DataField="Address" HeaderText="Địa chỉ" SortExpression="Address" />
					<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
					<asp:BoundField DataField="Subject" HeaderText="Ti&#234;u đề" SortExpression="Subject" />
					<asp:TemplateField HeaderText="Nội dung" SortExpression="Content">
						<EditItemTemplate>
							<asp:TextBox ID="TextBox1" runat="server" Height="93px" Text='<%# Bind("Content") %>'
								TextMode="MultiLine" Width="100%"></asp:TextBox>
						</EditItemTemplate>
						<InsertItemTemplate>
							<asp:TextBox ID="TextBox1" runat="server" Height="93px" Text='<%# Bind("Content") %>'
								TextMode="MultiLine" Width="100%"></asp:TextBox>
						</InsertItemTemplate>
						<ItemTemplate>
							<asp:Label ID="Label1" runat="server" Text='<%# Bind("Content") %>'></asp:Label>
						</ItemTemplate>
					</asp:TemplateField>
					<asp:TemplateField HeaderText="Trạng th&#225;i">
						<ItemTemplate>
							<asp:DropDownList ID="dropStatus" runat="server" SelectedValue='<%# Bind("Status") %>'>
								<asp:ListItem Value="2">Đ&#227; xử l&#253;</asp:ListItem>
								<asp:ListItem Value="1">Chưa xử l&#253;</asp:ListItem>
							</asp:DropDownList>
						</ItemTemplate>
					</asp:TemplateField>
					<asp:CommandField EditText="Sửa" CancelText="Hủy" ShowEditButton="True" UpdateText="Cập nhật" DeleteText="Xo&#225;" />
					
				</Fields>
			</asp:DetailsView>
		</td>
	</tr>
</table>
